package com.leejxx.admin.controller.v1;

import com.leejxx.admin.service.AdSensitiveService;
import com.leejxx.model.common.dto.ResponseResult;
import com.leejxx.model.admin.dtos.SensitiveDto;
import com.leejxx.model.admin.pojos.AdSensitive;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author LeeJx
 * @ClassName AdSensitiveController
 * @Description TODO
 * @date 2021/2/19 16:40
 * @Version 1.0
 */
@RestController
@Slf4j
@RequestMapping("/api/v1/sensitive")
public class AdSensitiveController {
    @Autowired
    private AdSensitiveService adSensitiveService;

    @RequestMapping("/list")
    public ResponseResult findByNameAndPage(@RequestBody SensitiveDto sensitiveDto) {
        log.info("[data]:{}", sensitiveDto);
        return adSensitiveService.findByNameAndPage(sensitiveDto);
    }

    @RequestMapping("/save")
    public ResponseResult saveSensitive(@RequestBody AdSensitive adSensitive) {
        log.info("[data]:{}", adSensitive);
        return adSensitiveService.saveSensitive(adSensitive);
    }

    @RequestMapping("/update")
    public ResponseResult updateSensitive(@RequestBody AdSensitive adSensitive) {
        log.info("[data]:{}", adSensitive);
        return adSensitiveService.updateSensitive(adSensitive);
    }

    @RequestMapping("/del/{id}")
    public ResponseResult deleteSensitive(@PathVariable String id) {
        log.info("[data]:{}", id);
        return adSensitiveService.deleteSensitive(id);
    }
}
